/**
* 创建者：luyiming
* 该组件用于：
* 创建时间： 2020-01-06 21:13:53
* @param 参数说明
* @emit 事件使用说明
*/
import echarts from 'echarts';
import resize from "./mixins/resize";
import FishChart from "@/components/luyiming/FishChart/index.vue"
export default {
	mixins: [resize],
    name: 'ThemeFish_cmp',
    props: {
        // 这是示例数据的通途
        example: {
            type: Array,
            default: () => []
		},
		chartData: {
			type: Object,
            default: () => ({
				data: [],
				xdata: [],
				efData: [],
				vmap: [],
				scaData:[],
			}),
		},
		lineData: {
			type: Object,
            default: () => ({
				xData: [],
				vData: [],
			}),
		},
		isClick: {
			type: Boolean,
			default: () => true
		},
	},
	components: {
		FishChart
	},
    // 数据
    data() {
        return {
			fishData: [
				{
					start: 0,
					end: 1,
					status: '出库'
				},
				{
					start: 0,
					end: 1,
					status: '出库'
				},
				{
					start: 0,
					end: 1,
					status: '出库'
				},
				{
					start: 0,
					end: 1,
					status: '出库'
				}
			],
			chart: null,
			chartFish: null,
        }
    },
    // 监听
    watch: {
		chartData(){

		},
		lineData(value){
			this.chart = echarts.init(this.$refs.linechart)
			this.chart.setOption(this.getLineData(value))
		},
    },
    // Vue实例初始化完成
    created() {

    },
    // Vue挂载完成
    mounted() {

    },
    // Vue实例销毁前
    beforeDestroy(){

    },
    // 挂载的方法
    methods: {
        /**
        * 方法描述
        */
        exampleFunc(){
            return void 0
		},
		init(){

		},
		getLineData(values){
			const option = {
				grid: this.gridData(),
				xAxis: {
					type: 'category',
					data: values.xData,
					boundaryGap: false,
				},
				yAxis: {
					type: 'value'
				},
				tooltip: {
					trigger: 'item'
				},
				series: [{
					data: values.vData,
					type: 'line',
					symbol: 'circle',
					symbolSize: 10,
					itemStyle: {
						color: '#1890ff'
					},
					tooltip: {
						show: true,
						position: 'top',
						backgroundColor: '#707070',
						padding: [16, 8, 16, 8],
						textStyle: {
							fontFamily: 'pingfang sans-serif' ,
							fontSize: 12,
						},
						formatter: (param) => {
							return `${param.name} <br/>监测剂量：${param.data}uSv/h`
						},

					}
					// emphasis: {
					// 	label: {
					// 		show: true,
					// 		backgroundColor: '#707070',
					// 		color: '#fff',
					// 		padding: [16, 8, 16, 8],
					// 		formatter: () => '1111' ,
					// 		fontFamily: 'pingfang sans-serif' ,
					// 	}
					// }
				}]
			};
			return option;
		},

		gridData(){
			return {
				left: '5%',
				right: '5%',
				bottom: '20',
				top: '5%',
			}
		},
		clickFish(param){
			this.$emit('clickFish', param)
		},
    },
}
